<?php
//SANITIZE ALL ESCAPES
// (note this is already completed by the script that includes this
//    get_patient_info.php )
//STOP FAKE REGISTER GLOBALS
// (note this is already completed by the script that includes this
//    get_patient_info.php )
//continue session
session_start();

//landing page definition -- where to go if something goes wrong
$landingpage = "index.php?site=" . $_SESSION['site_id'];
//
// kick out if patient not authenticated
if (isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite'])) {
    $pid = $_SESSION['pid'];
} else {
    session_destroy();
    header('Location: ' . $landingpage . '&w');
    exit;
}

$_SESSION['patient_portal_sac'] = 1;

$ignoreAuth = true;
global $ignoreAuth;
global $listTimeline;

require_once("../interface/globals.php");
require_once("$srcdir/patient.inc");
require_once("$srcdir/acl.inc");
require_once("$srcdir/classes/Address.class.php");
require_once("$srcdir/classes/InsuranceCompany.class.php");
require_once("$srcdir/classes/Document.class.php");
require_once("$srcdir/options.inc.php");
require_once("$srcdir/formatting.inc.php");
require_once("$srcdir/edi.inc");
include_once("$srcdir/lists.inc");
require_once("$srcdir/clinical_rules.php");
require_once("$srcdir/sql.inc");

//Set the time out
set_time_limit(0);

function pic_array() {
    $picture_directory = "Patient Photograph"; //change this if you want
    $pics = array();
    $sql_query = "select documents.id from documents join categories_to_documents on documents.id = categories_to_documents.document_id join categories on categories.id = categories_to_documents.category_id where categories.name like ? and documents.foreign_id = ?";
    if ($query = sqlStatement($sql_query, array($picture_directory, $_SESSION['pid']))) {
        $results = sqlFetchArray($query);

        if (count($results) > 0) {
            /* echo "<pre>";
              print_r($results);
              echo "</pre>";die; */
            $tmp = $results['id'];
            if (isset($tmp)) {
                array_push($pics, "<div id='photograph' class='patient_pic'><img width='100px' height='100px' src='" . $GLOBALS['webroot'] . "/controller.php?document&retrieve&patient_id=" . htmlspecialchars($_SESSION['pid'], ENT_QUOTES) . "&document_id=" . htmlspecialchars($tmp, ENT_QUOTES) . "&as_file=false' alt='Foto'></div>\n");
            } else {
                array_push($pics, "<div id='photograph' class='patient_pic'><img width='100px' src='images/patient.png' alt='Foto'></div>\n");
            }
        } else {
            array_push($pics, "<div id='photograph' class='patient_pic'><img height='88px' src='images/patient.png' alt='Foto'></div>\n");
        }
    }
    return $pics;
}

function output_file($file, $name, $mime_type = '') {
    /*
      This function takes a path to a file to output ($file),  the filename that the browser will see ($name) and  the MIME type of the file ($mime_type, optional).
     */

    //Check the file premission
    if (!is_readable($file))
        die('File not found or inaccessible!');

    $size = filesize($file);
    $name = rawurldecode($name);

    /* Figure out the MIME type | Check in array */
    $known_mime_types = array(
        "pdf" => "application/pdf",
        "txt" => "text/plain",
        "html" => "text/html",
        "htm" => "text/html",
        "exe" => "application/octet-stream",
        "zip" => "application/zip",
        "doc" => "application/msword",
        "xls" => "application/vnd.ms-excel",
        "ppt" => "application/vnd.ms-powerpoint",
        "gif" => "image/gif",
        "png" => "image/png",
        "jpeg" => "image/jpg",
        "jpg" => "image/jpg",
        "php" => "text/plain"
    );

    if ($mime_type == '') {
        $file_extension = strtolower(substr(strrchr($file, "."), 1));
        if (array_key_exists($file_extension, $known_mime_types)) {
            $mime_type = $known_mime_types[$file_extension];
        } else {
            $mime_type = "application/force-download";
        };
    };

    //turn off output buffering to decrease cpu usage
    @ob_end_clean();

    // required for IE, otherwise Content-Disposition may be ignored
    if (ini_get('zlib.output_compression'))
        ini_set('zlib.output_compression', 'Off');

    header('Content-Type: ' . $mime_type);
    header('Content-Disposition: attachment; filename="' . $name . '"');
    header("Content-Transfer-Encoding: binary");
    header('Accept-Ranges: bytes');

    /* The three lines below basically make the 
      download non-cacheable */
    header("Cache-control: private");
    header('Pragma: private');
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    // multipart-download and download resuming support
    if (isset($_SERVER['HTTP_RANGE'])) {
        list($a, $range) = explode("=", $_SERVER['HTTP_RANGE'], 2);
        list($range) = explode(",", $range, 2);
        list($range, $range_end) = explode("-", $range);
        $range = intval($range);
        if (!$range_end) {
            $range_end = $size - 1;
        } else {
            $range_end = intval($range_end);
        }
        /*
          ------------------------------------------------------------------------------------------------------
          //This application is developed by www.webinfopedia.com
          //visit www.webinfopedia.com for PHP,Mysql,html5 and Designing tutorials for FREE!!!
          ------------------------------------------------------------------------------------------------------
         */
        $new_length = $range_end - $range + 1;
        header("HTTP/1.1 206 Partial Content");
        header("Content-Length: $new_length");
        header("Content-Range: bytes $range-$range_end/$size");
    } else {
        $new_length = $size;
        header("Content-Length: " . $size);
    }

    /* Will output the file itself */
    $chunksize = 1 * (1024 * 1024); //you may want to change this
    $bytes_send = 0;
    if ($file = fopen($file, 'r')) {
        if (isset($_SERVER['HTTP_RANGE']))
            fseek($file, $range);

        while (!feof($file) &&
        (!connection_aborted()) &&
        ($bytes_send < $new_length)
        ) {
            $buffer = fread($file, $chunksize);
            print($buffer); //echo($buffer); // can also possible
            flush();
            $bytes_send += strlen($buffer);
        }
        fclose($file);
    }
    else
    //If no permissiion
        die('Error - can not open file.');
    //die
    die();
}

//path to the file
//$file_path='files/'.$_REQUEST['filename'];
//Call the download function with file path,file name and file type
//output_file($file_path, ''.$_REQUEST['filename'].'', 'text/plain');
?>
<html> 

    <head>
        <link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <title>Expediente M&eacute;dico Personal | SaludaunClic.com</title>
        <link rel="stylesheet" type="text/css" href="<?php echo $web_root; ?>/library/dynarch_calendar.css">
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/textformat.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/dynarch_calendar.js"></script>
        <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/dynarch_calendar_setup.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/dialog.js"></script>
        <!--<script type="text/javascript" src="<?php echo $web_root; ?>/library/js/jquery.1.3.2.js"></script>-->
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/jquery-1.10.0.min.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/jquery-migrate-1.2.1.min.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/jquery.tools.min.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/common.js"></script>
        <!--<script type="text/javascript" src="<?php echo $web_root; ?>/library/js/jquery.simplemodal.1.4.4.min.js"></script>-->
        <script type="text/javascript" src="<?php echo $web_root; ?>/patients/js/ajtooltip.js"></script>
        <!-- bin/jquery.slider.min.js -->
        <script type="text/javascript" src="<?php echo $web_root; ?>/patients/js/jshashtable-2.1_src.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/patients/js/jquery.numberformatter-1.2.3.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/patients/js/tmpl.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/patients/js/jquery.dependClass-0.1.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/patients/js/draggable-0.1.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/patients/js/jquery.slider.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/jquery-accordion.js"></script>
        <script type="text/javascript" src="<?php echo $web_root; ?>/library/js/jquery.fancybox.pack.js" ></script>
        <!-- end -->

        <link rel="stylesheet" href="css/base.css" type="text/css"/>
        <link rel="stylesheet" href="css/nightingale.css" type="text/css"/>
        <link rel="stylesheet" href="css/tables.css" type="text/css"/>
        <link rel="stylesheet" href="css/jslider.css" type="text/css">
        <link rel="stylesheet" href="css/jslider.blue.css" type="text/css">
        <link rel="stylesheet" href="css/jslider.plastic.css" type="text/css">
        <link rel="stylesheet" href="css/jslider.round.css" type="text/css">
        <link rel="stylesheet" href="css/jslider.round.plastic.css" type="text/css">
        <link rel="stylesheet" href="css/jquery-accordion.css" type="text/css" >
        <link media="screen" href="css/jquery.fancybox.css?v=2.1.5" type="text/css" rel="stylesheet">
        <script type="text/javascript" language="JavaScript">

            function toggleIndicator(target, div) {
                $mode = $(target).find(".indicator").text();
                if ($mode == "<?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?>") {
                    $(target).find(".indicator").text("<?php echo htmlspecialchars(xl('expand'), ENT_QUOTES); ?>");
                    $("#" + div).hide();
                } else {
                    $(target).find(".indicator").text("<?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?>");
                    $("#" + div).show();
                }
            }

            function refreshPatientData() {
                $("#get_patient_data").load("get_patient_data.php");
            }

            function refreshAppointments() {
                $("#citas").load("get_appointments.php");
            }

            function refreshExamenes() {
                $("#examenes").load("get_lab_results.php");
            }

            function refreshReportes(print) {
                $("#reportes").load("get_reportes.php", {'embeddedScreen': true}, function() {
                    $(".generateCCR").click(
                            function() {
                                if (document.getElementById('show_date').checked == true) {
                                    if (document.getElementById('Start').value == '' || document.getElementById('End').value == '') {
                                        alert('<?php echo addslashes(xl('Please select a start date and end date')) ?>');
                                        return false;
                                    }
                                }
                                var ccrAction = document.getElementsByName('ccrAction');
                                ccrAction[0].value = 'generate';
                                var raw = document.getElementsByName('raw');
                                raw[0].value = 'no';
                                ccr_form.setAttribute("target", "_blank");
                                $("#ccr_form").submit();
                                ccr_form.setAttribute("target", "");
                            }
                    );

                    $(".generateCCR_raw").click(
                            function() {
                                var ccrAction = document.getElementsByName('ccrAction');
                                ccrAction[0].value = 'generate';
                                var raw = document.getElementsByName('raw');
                                raw[0].value = 'yes';
                                ccr_form.setAttribute("target", "_blank");
                                $("#ccr_form").submit();
                                ccr_form.setAttribute("target", "");
                            });

                    $(".generateCCR_download_h").click(
                            function() {
                                var ccrAction = document.getElementsByName('ccrAction');
                                ccrAction[0].value = 'generate';
                                var raw = document.getElementsByName('raw');
                                raw[0].value = 'hybrid';
                                $("#ccr_form").submit();
                            });

                    $(".generateCCR_download_p").click(
                            function() {
                                if (document.getElementById('show_date').checked == true) {
                                    if (document.getElementById('Start').value == '' || document.getElementById('End').value == '') {
                                        alert('<?php echo addslashes(xl('Please select a start date and end date')) ?>');
                                        return false;
                                    }
                                }
                                var ccrAction = document.getElementsByName('ccrAction');
                                ccrAction[0].value = 'generate';
                                var raw = document.getElementsByName('raw');
                                raw[0].value = 'pure';
                                $("#ccr_form").submit();
                            });

                    $(".viewCCD").click(
                            function() {
                                var ccrAction = document.getElementsByName('ccrAction');
                                ccrAction[0].value = 'viewccd';
                                var raw = document.getElementsByName('raw');
                                raw[0].value = 'no';
                                ccr_form.setAttribute("target", "_blank");
                                $("#ccr_form").submit();
                                ccr_form.setAttribute("target", "");
                            });

                    $(".viewCCD_raw").click(
                            function() {
                                var ccrAction = document.getElementsByName('ccrAction');
                                ccrAction[0].value = 'viewccd';
                                var raw = document.getElementsByName('raw');
                                raw[0].value = 'yes';
                                ccr_form.setAttribute("target", "_blank");
                                $("#ccr_form").submit();
                                ccr_form.setAttribute("target", "");
                            });

                    if (print == 1) {
                        $(".generateCCR").click();
                    }
                });


            }

            function refreshProblemasClinicos() {
                $("#problemasClinicos").load("get_problems.php");
            }

            function refreshAlergias() {
                $("#alergias").load("get_allergies.php");
            }

            function refreshHistorial() {
                $("#historial").load("get_historial.php");
            }

            function refreshAntecedentes() {
                $("#antecedentes").load("get_antecedentes.php");
            }

            function refreshEventos() {
                $("#eventos").load("get_encounters.php", {'embeddedScreen': true}, function() {
                    $("#eventos").css('display', 'block');
                    $("#reportes").css('display', 'none');
                });
            }

            /*Medicamentos*/
            function refreshMedications() {
                $("#medicamentos").load("get_medications.php");
            }

            /*Vacunas*/
            function refreshVacunas() {
                $("#vacunaciones").load("get_immunizations.php");
            }

            /*Signos vitales*/
            function refreshSignos() {
                $("#signos").load("get_vitals_fragment.php");
            }

            /*Recordatorios medicos*/
            function refreshRecordatorios() {
                $("#recordatorios").load("get_reminders.php");
            }

            function show_date_fun() {
                if (document.getElementById('show_date').checked == true) {
                    document.getElementById('date_div').style.display = '';
                } else {
                    document.getElementById('date_div').style.display = 'none';
                }
                return;
            }

            function homepage() {

                refreshPatientData();
                refreshMedications();
                refreshVacunas();
                refreshSignos();
                /*refreshAntecedentes();*/
                refreshAlergias();
                //refreshHistorial();
                /*refreshRecordatorios();*/
                refreshEventos();
                /*
                 refreshSignos(); 
                 refreshAppointments();
                 refreshExamenes();
                 refreshReportes();
                 refreshProblemasClinicos();
                 */

            }

            $(document).ready(function() {
                // load views
                homepage();

                var currentID;

                $('.personPopupTrigger').live('click', function(e) {
                    e.preventDefault();
                    // format of 'rel' tag: pageid,personguid
                    var pageID = $(this).attr('rel');
                    var urlID = $(this).attr('id');
                    currentID = <?php echo $_SESSION['pid'] ?>;

                    // If no guid in url rel tag, don't popup blank
                    if (currentID == '')
                        return;

                    var parts = pageID.split("~");
                    var enc = parts[0];
                    var datestr = parts[1];

                    var url = 'encounter.php?set_encounter=' + enc + '&datestr=' + datestr;

                    $("#" + urlID).attr("href", url);

                    parent.$.fancybox({
                        href: this.href,
                        autoSize: true,
                        type: 'iframe',
                        helpers: {
                            overlay: {
                                opacity: 0.3,
                                css: {
                                    'background': 'rgba(255, 254, 254,0.85)'
                                }
                            } // overlay
                        } // helpers
                    }); // fancybox
                });

                $("#homepage").click(function() {
                    homepage();
                });

                $("#tarjeta").click(function() {
                    $("#eventos").css('display', 'none');
                    $("#reportes").css('display', 'block');
                    refreshReportes();
                });

                $("#print_btn").click(function() {
                    $("#eventos").css('display', 'none');
                    $("#reportes").css('display', 'block');
                    refreshReportes(1);
                });

                $("#by_date").live('click', (function() {
                    $('#by_date').addClass('active');
                    $('#by_condition').removeClass('active');
                    $('#by_type').removeClass('active');

                    $("#barra").css('display', 'block');
                    $("#timeline").css('display', 'block');
                    $("#examenes").css('display', 'none');
                    $("#problemasClinicos").css('display', 'none');
                    $("#citas").css('display', 'none');

                }));

                $("#by_condition").live('click', (function() {
                    $('#by_condition').addClass('active');
                    $('#by_date').removeClass('active');
                    $('#by_type').removeClass('active');

                    $("#barra").css('display', 'none');
                    $("#timeline").css('display', 'none');
                    $("#examenes").css('display', 'none');
                    $("#problemasClinicos").css('display', 'none');
                    $("#citas").css('display', 'none');
                }));

                $("#by_type").live('click', (function() {
                    $('#by_type').addClass('active');
                    $('#by_date').removeClass('active');
                    $('#by_condition').removeClass('active');

                    $("#barra").css('display', 'none');
                    $("#timeline").css('display', 'none');

                    refreshExamenes();
                    $("#examenes").css('display', 'block');

                    refreshProblemasClinicos();
                    $("#problemasClinicos").css('display', 'block');

                    refreshAppointments();
                    $("#citas").css('display', 'block');

                }));

                $('#historial_enlace').click(function(e) {
                    e.preventDefault();
                    parent.$.fancybox({
                        href: this.href,
                        maxWidth: 775,
                        minHeight: 500,
                        fitToView: false,
                        type: 'iframe',
                        beforeShow: function() {
                            this.width = $('.fancybox-iframe').contents().find('html').width();
                            this.height = $('.fancybox-iframe').contents().find('html').height();
                        },
                        helpers: {
                            overlay: {
                                opacity: 0.3,
                                css: {
                                    'background': 'rgba(255, 254, 254,0.85)'
                                }
                            } // overlay
                        } // helpers
                    }); // fancybox
                }); // click
                
                $('#citas').click(function(e) {
                    e.preventDefault();
                    parent.$.fancybox({
                        href: this.href,
                        maxWidth: 650,
                        minHeight: 380,
                        fitToView: false,
                        type: 'iframe',
                        beforeShow: function() {
                            this.width = $('.fancybox-iframe').contents().find('html').width();
                            this.height = $('.fancybox-iframe').contents().find('html').height();
                        },
                        helpers: {
                            overlay: {
                                opacity: 0.3,
                                css: {
                                    'background': 'rgba(255, 254, 254,0.85)'
                                }
                            } // overlay
                        } // helpers
                    }); // fancybox
                }); // click

                $('#uploader').click(function(e) {
                    e.preventDefault();
                    parent.$.fancybox({
                        href: this.href,
                        autoSize: false,
                        type: 'iframe',
                        helpers: {
                            overlay: {
                                opacity: 0.3,
                                css: {
                                    'background': 'rgba(255, 254, 254,0.85)'
                                }
                            } // overlay
                        }, // helpers
                        afterClose: function() {
                            $("#eventos").load("get_encounters.php", {'embeddedScreen': true}, function() {
                                $("#eventos").css('display', 'block');
                                $("#reportes").css('display', 'none');
                            });
                        }//afterClose
                    }); // fancybox
                }); // click
                
                 $('#config').click(function(e) {
                    e.preventDefault();
                   /* parent.$.fancybox({
                        href: this.href,
                        autoSize: false,
                        type: 'iframe',
                        helpers: {
                            overlay: {
                                opacity: 0.3,
                                css: {
                                    'background': 'rgba(255, 254, 254,0.85)'
                                }
                            } // overlay
                        }, // helpers
                        afterClose: function() {
                            
                        }//afterClose
                    }); // fancybox*/
                       $listTimeline = $("#eventos").html();
                       $("#eventos").load("config_patient.php",{dataHtml:$listTimeline});
        
                }); // click
                $("#accordion").jqueryAccordion({
                    interval: 300,
                    fadeContent: true,
                    open: false,
                    defaultOpenIndex: 1
                });
            });
            /********************************************************/
            function todocument(docid) {
                h = '<?php echo $GLOBALS['webroot'] ?>/controller.php?document&view&patient_id=<?php echo $pid ?>&doc_id=' + docid;
                alert(h);
                //location.href = h;
            }

            function efmouseover(elem, ptid, encid, formname, formid) {
                ttMouseOver(elem, "encounters_ajax.php?ptid=" + ptid + "&encid=" + encid +
                        "&formname=" + formname + "&formid=" + formid);
            }

            function divtoggle(spanid, divid) {
                var ele = document.getElementById(divid);
                var text = document.getElementById(spanid);
                if (ele.style.display == "block") {
                    ele.style.display = "none";
                    text.innerHTML = "<?php xl('Expand', 'e'); ?>";
                }
                else {
                    ele.style.display = "block";
                    text.innerHTML = "<?php xl('Collapse', 'e'); ?>";
                }
            }

            function expandcollapse(atr) {
                if (atr == "expand") {
                    for (i = 1; i < 15; i++) {
                        var mydivid = "divid_" + i;
                        var myspanid = "spanid_" + i;
                        var ele = document.getElementById(mydivid);
                        var text = document.getElementById(myspanid);
                        ele.style.display = "block";
                        text.innerHTML = "<?php xl('Collapse', 'e'); ?>";
                    }
                }
                else {
                    for (i = 1; i < 15; i++) {
                        var mydivid = "divid_" + i;
                        var myspanid = "spanid_" + i;
                        var ele = document.getElementById(mydivid);
                        var text = document.getElementById(myspanid);
                        ele.style.display = "none";
                        text.innerHTML = "<?php xl('Expand', 'e'); ?>";
                    }
                }

            }
        </script>
        <!--[if lt IE 7]>
        <style type='text/css'>
                #simplemodal-container a.modalCloseImg {
                        background:none;
                        right:-14px;
                        width:22px;
                        height:26px;
                        filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
                                src='img/x.png', sizingMethod='scale'
                        );
                }
        </style>
        <![endif]-->
    </head>

    <body class="body_top">
        <div id="main">
            <?php
            $result = getPatientData($pid);
            ?>
            <div id="header_mainmenu">
                <a class="mm_logo" href="http://www.saludaunclic.com" target="_blank"></a>
                <a class="mm_home" id="homepage" href="#">Inicio</a>
                <a id="citas" href="set_appointment.php" class="mm_wishlist fancybox.iframe">Solicitar Cita</a>
                <a href="http://www.saludaunclic.com/index.php?option=com_easyblog&view=latest&Itemid=114" target="_blank" style=" background-color: rgb(62, 181, 131);" class="mm_blog">Blog</a>
                <a id="tarjeta" href="#" style=" background-color: rgb(62, 181, 111);" class="mm_checkout">Tarjeta inteligente</a>
                <a href="http://www.saludaunclic.com/compras/" target="_blank" style=" background-color: rgb(62, 181, 111);" class="mm_shopcart">Comprar</a>
                <div class="clear"></div>
            </div>
            <div id="main_toolbar">	
                <p>
                    <span id="nombre_paciente"></span>
                    <span style="float: right;">
                            <!--<a href="#" id="print_btn" title="Imprimir expediente"><img id="print" src="images/print.png"></img></a>-->
                            <!--<a href="#" title="Configuraci&oacute;n"><img id="config" src="images/config.png"></img></a>-->
                        <a title="Configuracion"  id="config"><!--class="iframe_grafico btnNav fancybox.iframe"-->
                            <i class="icon-gear menu_icon_size"></i>
                        </a>
                        <a href='uploader/Bootstrap.php' title="Subir documento" class="iframe_grafico btnNav fancybox.iframe" id='uploader'>
                            <i class="icon-cloud-upload menu_icon_size"></i>
                        </a>
                        <a href="#" title="<?php echo xl('Log Out'); ?>" onclick="window.location = 'logout.php'">
                            <i class="icon-signout menu_icon_size"></i>
                        </a>
                    </span>
                </p>
            </div>
            <div id="column_right">
                <div id="reportes" class="wrapper_clinico_meds" class="border title2" style="margin-bottom: 5px;display:none;"></div>
                <div id="eventos" class="wrapper_clinico_meds" class="border title2" style="margin-bottom: 5px;"></div>	

            </div>
            <!-- end column_right -->
            <div id="column_left">
                <div id="get_patient_data"></div>
                <div id="column_historial" class="border">
                    <div class="historial_paciente">
                        <span><?php echo xl("History");?> <span><a href='history_full.php?pid=<?php echo $_SESSION['pid']; ?>' class="enlace_grafico iframe_grafico btnNav fancybox.iframe" id='historial_enlace'>Ver</a></span></span>
                    </div>
                </div>                

                <div id="accordion" class="accordion mi_acordion">
                    <div class="accordion-item">
                        <div class="accordion-header">
                            <span class="title"><?php echo xl("Vitals");?></span>
                            <i class="icon-bar-chart"></i>
                        </div>	
                        <div class="accordion-content">
                            <div id="signos" class="patient_secondary"></div>	
                        </div>
                    </div>
                    <div class="accordion-item">
                        <div class="accordion-header">
                            <span class="title">Alergias</span>
                            <i class="icon-font"></i>
                        </div>	
                        <div class="accordion-content">
                            <div id="alergias" class="patient_secondary"></div>	
                        </div>
                    </div>
                    <div class="accordion-item">
                        <div class="accordion-header">
                            <span class="title">Medicamentos</span>
                            <i class="icon-medkit"></i>
                        </div>	
                        <div class="accordion-content">
                            <div id="medicamentos" class="patient_secondary"></div>	
                        </div>
                    </div>
                    <div class="accordion-item">
                        <div class="accordion-header">
                            <span class="title">Vacunaciones</span>
                            <i class="icon-pushpin"></i>
                        </div>	
                        <div class="accordion-content">
                            <div id="vacunaciones" class="patient_secondary"></div>	
                        </div>
                    </div>
                </div>
                <!--
                <div id="accordion" class="accordion">
                        <div class="accordion-item">
                                <div class="accordion-header">
                                        <span class="title">Recordatorios Cl&iacute;nicos y Medicamentos</span>
                                        <i class="icon-medkit"></i>
                                </div>	
                                <div class="accordion-content">
                                        <div class="parent_medicamentos" id="recordatorios_medicamentos"></div>	
                                </div>
                        </div>
                        <div class="accordion-item">
                                <div class="accordion-header">
                                        <span class="title">
                <?php echo htmlspecialchars(xl('Patient History / Lifestyle'), ENT_NOQUOTES); ?> 
                                                <a href="history_full.php"><?php echo htmlspecialchars(xl("Edit"), ENT_NOQUOTES); ?></a>
                                        </span>
                                        <i class="icon-h-sign"></i>
                                </div>	
                                <div class="accordion-content"> 
                                        <div id="historial" style="margin-bottom: 5px;"></div>
                                </div>				
                        </div>
                </div>
                -->
                <div id="recordatorios" class="patient_secondary"></div>
                <div class="patient_secondary" id="memo" style="background-color: #F5F5F5; padding: 1px 14px; font-size: 12px;color:#AAAAAA;text-align: justify;">
                    <h3 style="font-size: 20px; font-variant: normal; font-weight: bold; letter-spacing: normal; margin-bottom: 0px;margin-top: 5px;">Bienvenid@</h3>
                    <p>Esta es la versi&oacute;n No.1 del expediente electr&oacute;nico de Salud a un Clic que hoy inicia su lanzamiento para los asociados de Asemag por lo que les damos la bienvenida y les solicitamos informarnos de cualquier inconveniente que se le presente al correo <span style="color:#3EB5AB;">expediente@saludaunclic.com</span></p>
                    <p>Puede descargar sus documentos en cualquier momento y su informaci&oacute;n m&eacute;dica puede ser actualizada por su m&eacute;dico desde la <a href="https://expediente.saludaunclic.com" target="_blank" style="color:#3EB5AB;">versi&oacute;n para m&eacute;dicos.</a></p>
                    <p>Atte: Equipo Salud a un Clic.</p>
                </div>
                <a href="http://www.saludaunclic.com/index.php?option=com_easyblog&amp;view=latest&amp;Itemid=114" target="_blank"><div class="patient_secondary" style="margin-top: 15px;"><img width="290" src="images/banner.jpg"></div></a>
            </div>
        </div>

    </body>
</html>